1. Field of the Invention
The present invention relates to communication networks, and, more particularly, to calculation of a checksum value for a packet of data.
2. Description of the Related Art
As packet-based networks are increasingly utilized for communication, network traffic throughput speeds are also increased. Modules designed to route packets must process packets at increasingly higher speeds to achieve these higher network traffic throughput speeds. In particular, many of the common arithmetic operations are performed at higher speeds. One such arithmetic operation is calculation of the checksum for a packet to identify a corrupt packet.
Many network protocols detect corrupt packets by including a checksum that applies to a specific portion of the packet. Typically, the checksum is included in a header of the packet. A receiver calculates the checksum of the packet, compares it to the checksum included in the packet's header, and declares a corrupt packet if the two values do not match. The checksum may be calculated in many ways. One method employed in many packet networks partitions a portion of the packet (the “subpacket” that generally includes the data but not the header and start/end flags) into L-bit unsigned words. The L-bit unsigned words are added together using one's-complement addition, and then the checksum is set as the one's-complement of the result. If the number of bits in the subpacket is not an integer multiple of the L-bit word size, the final L-bit word comprises the remaining subpacket byte's bits as the most significant bits (MSBs) and zero padding for the remaining bits (the least significant bits, or LSBs).